import Vue from 'vue'
import App from './App'
import VueRouter from 'vue-router'
import router from './router/index'
import 'ant-design-vue/dist/antd.css';
import Antd from 'ant-design-vue';
import Util from './libs/util';
//导入axios
import axios from 'axios'
import VueAxios from 'vue-axios'
//vuex
import Vuex from 'vuex'
import 'es6-promise/auto'
//导入接口
import services from './services'

Vue.config.productionTip = false

Vue.prototype.$api = services
Vue.use(Antd);
Vue.use(VueRouter);
Vue.use(VueAxios,axios)
Vue.use(Vuex)

//路由守卫
router.beforeEach((to, from, next) => {
  Util.title(to.matched[0].name);
  next();
});

router.afterEach((to, from, next) => {
  window.scrollTo(0, 0);
});

new Vue({
  el: '#app',
  router,
  render: h => h(App)
})
